using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._ClassificationandPatternRecognition
{
    /// <summary>
    /// <para>Train Support Vector Machine Classifier</para>
    /// <para>Generates an Esri classifier definition file (.ecd) using the Support Vector Machine (SVM) classification definition.</para>
    /// <para>使用支持向量机 （SVM） 分类定义生成 Esri 分类器定义文件 （.ecd）。</para>
    /// </summary>    
    [DisplayName("Train Support Vector Machine Classifier")]
    public class TrainSupportVectorMachineClassifier : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TrainSupportVectorMachineClassifier()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster dataset to classify.</para>
        ///   <para>The preferred input is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a 1-band, 8-bit grayscale segmented raster. If no segmented raster is available, you can use any Esri-supported raster dataset.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要分类的栅格数据集。</para>
        ///   <para>首选输入是 3 波段、8 位分段栅格数据集，其中同一线段中的所有像素都具有相同的颜色。输入也可以是 1 波段 8 位灰度分割栅格。如果没有可用的分割栅格，则可以使用任何 Esri 支持的栅格数据集。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_training_features">
        /// <para>Input Training Sample File</para>
        /// <para><xdoc>
        ///   <para>The training sample file or layer that delineates the training sites.</para>
        ///   <para>These can be either shapefiles or feature classes that contain the training samples. The following field names are required in the training sample file:
        ///   <bulletList>
        ///     <bullet_item>classname—A text field indicating the name of the class category  </bullet_item><para/>
        ///     <bullet_item>classvalue—A long integer field containing the integer value for each class category  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于描述训练站点的训练示例文件或图层。</para>
        /// <para>这些可以是包含训练样本的 shapefile 或要素类。训练示例文件中需要以下字段名称：
        ///   <bulletList>
        ///     <bullet_item>classname - 指示类类别名称的文本字段</bullet_item><para/>
        ///     <bullet_item>classvalue - 包含每个类类别的整数值的长整数字段</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_classifier_definition">
        /// <para>Output Classifier Definition File</para>
        /// <para>The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.</para>
        /// <para>输出 JSON 格式文件，其中包含分类器的属性信息、统计信息、超平面向量和其他信息。将创建一个 .ecd 文件。</para>
        /// </param>
        public TrainSupportVectorMachineClassifier(object _in_raster, object _in_training_features, object _out_classifier_definition)
        {
            this._in_raster = _in_raster;
            this._in_training_features = _in_training_features;
            this._out_classifier_definition = _out_classifier_definition;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Train Support Vector Machine Classifier";

        public override string CallName => "ia.TrainSupportVectorMachineClassifier";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "snapRaster", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _in_training_features, _out_classifier_definition, _in_additional_raster, _max_samples_per_class, _used_attributes, _dimension_value_field];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster dataset to classify.</para>
        ///   <para>The preferred input is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a 1-band, 8-bit grayscale segmented raster. If no segmented raster is available, you can use any Esri-supported raster dataset.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要分类的栅格数据集。</para>
        ///   <para>首选输入是 3 波段、8 位分段栅格数据集，其中同一线段中的所有像素都具有相同的颜色。输入也可以是 1 波段 8 位灰度分割栅格。如果没有可用的分割栅格，则可以使用任何 Esri 支持的栅格数据集。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Input Training Sample File</para>
        /// <para><xdoc>
        ///   <para>The training sample file or layer that delineates the training sites.</para>
        ///   <para>These can be either shapefiles or feature classes that contain the training samples. The following field names are required in the training sample file:
        ///   <bulletList>
        ///     <bullet_item>classname—A text field indicating the name of the class category  </bullet_item><para/>
        ///     <bullet_item>classvalue—A long integer field containing the integer value for each class category  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于描述训练站点的训练示例文件或图层。</para>
        /// <para>这些可以是包含训练样本的 shapefile 或要素类。训练示例文件中需要以下字段名称：
        ///   <bulletList>
        ///     <bullet_item>classname - 指示类类别名称的文本字段</bullet_item><para/>
        ///     <bullet_item>classvalue - 包含每个类类别的整数值的长整数字段</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Training Sample File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_training_features { get; set; }


        /// <summary>
        /// <para>Output Classifier Definition File</para>
        /// <para>The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.</para>
        /// <para>输出 JSON 格式文件，其中包含分类器的属性信息、统计信息、超平面向量和其他信息。将创建一个 .ecd 文件。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classifier Definition File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_classifier_definition { get; set; }


        /// <summary>
        /// <para>Additional Input Raster</para>
        /// <para>Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.</para>
        /// <para>将合并辅助栅格数据集（例如多光谱影像或 DEM）以生成属性和其他分类所需信息。此参数是可选的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Additional Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_additional_raster { get; set; } = null;


        /// <summary>
        /// <para>Maximum Number of Samples Per Class</para>
        /// <para><xdoc>
        ///   <para>The maximum number of samples that will be used to define each class.</para>
        ///   <para>The default value of 500 is recommended when the inputs are nonsegmented rasters. A value that is less than or equal to 0 means that the system will use all the samples from the training sites to train the classifier.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于定义每个类的最大样本数。</para>
        ///   <para>当输入为非分割栅格时，建议使用默认值 500。小于或等于 0 的值表示系统将使用训练站点中的所有样本来训练分类器。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number of Samples Per Class")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_samples_per_class { get; set; } = 1000;


        /// <summary>
        /// <para>Segment Attributes Used</para>
        /// <para><xdoc>
        ///   <para>Specifies the attributes that will be included in the attribute table associated with the output raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Converged color—The RGB color values will be derived from the input raster on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Mean digital number—The average digital number (DN) will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Count of pixels—The number of pixels composing the segment, on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Compactness—The degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.</bullet_item><para/>
        ///     <bullet_item>Rectangularity—The degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>This parameter is only active if the Segmented key property is set to true on the input raster. If the only input to the tool is a segmented image, the default attributes are Average chromaticity color, Count of pixels, Compactness, and Rectangularity. If an Additional Input Raster value is included as an input with a segmented image, Mean digital number and Standard deviation are also available attributes.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将包含在与输出栅格关联的属性表中的属性。</para>
        ///   <bulletList>
        ///     <bullet_item>收敛颜色 - RGB 颜色值将基于每个区段从输入栅格派生。</bullet_item><para/>
        ///     <bullet_item>平均数字数字 - 平均数字数字 （DN） 将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>标准差—标准差将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>像素计数 - 组成区段的像素数（按每个区段计算）。</bullet_item><para/>
        ///     <bullet_item>紧凑度 - 线段的紧凑度或圆形程度（基于每个线段）。值范围从 0 到 1，其中 1 是一个圆。</bullet_item><para/>
        ///     <bullet_item>矩形 - 线段的矩形程度（按线段计算）。值的范围为 0 到 1，其中 1 是矩形。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>仅当输入栅格上的分割键属性设置为 true 时，此参数才处于活动状态。如果工具的唯一输入是分割图像，则默认属性为平均色度颜色、像素计数、紧凑度和矩形度。如果附加输入栅格值作为分割影像的输入包含在内，则平均数字数和标准差也是可用属性。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Segment Attributes Used")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _used_attributes { get; set; } = null;


        /// <summary>
        /// <para>Dimension Value Field</para>
        /// <para><xdoc>
        ///   <para>Contains dimension values in the input training sample feature class.</para>
        ///   <para>This parameter is required to classify a time series of raster data using the change analysis raster output from the Analyze Changes Using CCDC tool.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含输入训练示例要素类中的维度值。</para>
        ///   <para>使用使用 CCDC 分析变化工具的变化分析栅格输出对栅格数据的时间序列进行分类时，需要此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Dimension Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _dimension_value_field { get; set; } = null;


        public TrainSupportVectorMachineClassifier SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, workspace: workspace);
            return this;
        }

    }

}